<!doctype html>
<html>
<head>
<meta name="Generator"  />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>优惠券</title>
<meta name="Keywords" content="Call管家" />
<meta name="Description" content="Call管家" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<link rel="stylesheet" href="__HOMECSS__/style.css">


</head>

<body>

<ul class="coupon_top">
    <li><span class="coupon_topthis" data-key="1">未使用</span></li>
    <li><span data-key="2">已使用</span></li>
</ul>
<ul class="coupon_bottom">
    <li>
<!--        <div class="duihuanma">
            <input type="text" placeholder="请输入兑换码">
            <span>兑换</span>
        </div>-->
        <ul class="coupon">
   
        </ul>
    </li>
</ul>

</body>
<script src="__HOMEJS__/jquery-1.7.2.min.js"></script>
<script src="__PUBLIC__/layer/layer.js"></script>
<script src="__HOMEJS__/mobileSelect.js" type="text/javascript"></script>
<script>
   $(function(){
      ajax_coupon();
    })
    $(function () {
        $(".coupon_top li").click(function () {
            $(".coupon_top li").find("span").removeClass('coupon_topthis')
            $(this).find("span").addClass('coupon_topthis')

            ajax_coupon();

        })
    })
    function ajax_coupon(){
    	var index = layer.load();
        
    	var status = $('.coupon_topthis').data('key');
    	$.ajax({
    		type:"post",
    		url:"{:Url('Coupon/ajax_coupon')}",
    		dataType:'json',
    		data:{status:status},
    		success:function(res){
                var html = '';
    			layer.close(index);
    			for(var i in res){
    			    var item = res[i];
                    html += '<li>\
                    <div class="coupon_head">\
                    <div class="couponhead_r" style="text-align: center;width: 100%;">\
                    <h3>'+item.goods_name+'</h3>\
                    </div>\
                    </div>\
                    </li>';
                }
                $('.coupon').html(html);
    		}
    	});
    }
</script>


</html>
